home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbpxen
/
itemedit.frm
< prev
next >
Wrap
Text File
|
1995-10-23
|
10KB
|
414 lines
VERSION 2.00
Begin Form itemedit
Caption = "Tape Inventory"
ClientHeight = 5130
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 7695
Height = 5535
Left = 1035
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 5130
ScaleWidth = 7695
Top = 1140
Width = 7815
Begin CommandButton ButtonDone
Caption = "E&xIt"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 12
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 615
Left = 6120
TabIndex = 11
Top = 4200
Width = 975
End
Begin CommandButton ButtonDelete
Caption = "&Delete"
Height = 615
Left = 4440
TabIndex = 14
Top = 4200
Visible = 0 'False
Width = 1095
End
Begin CommandButton ButtonCancel
Caption = "&Cancel"
Height = 615
Left = 1920
TabIndex = 13
Top = 4200
Visible = 0 'False
Width = 1095
End
Begin CommandButton ButtonOK
Caption = "&OK"
Height = 615
Left = 360
TabIndex = 12
Top = 4200
Visible = 0 'False
Width = 975
End
Begin CommandButton ButtonNew
Caption = "&Add"
Height = 495
Left = 6120
TabIndex = 10
Top = 3240
Width = 975
End
Begin CommandButton ButtonEdit
Caption = "&Edit"
Height = 495
Left = 6120
TabIndex = 9
Top = 2280
Width = 975
End
Begin CommandButton ButtonLast
Caption = "&Last"
Height = 375
Left = 6720
TabIndex = 8
Top = 1560
Width = 735
End
Begin CommandButton ButtonFirst
Caption = "&First"
Height = 375
Left = 5880
TabIndex = 7
Top = 1560
Width = 735
End
Begin CommandButton ButtonNext
Caption = "&Next"
Height = 375
Left = 6720
TabIndex = 6
Top = 960
Width = 735
End
Begin CommandButton ButtonPrior
Caption = "&Prior"
Height = 375
Left = 5880
TabIndex = 5
Top = 960
Width = 735
End
Begin TextBox tapetitle
Height = 375
Left = 2160
TabIndex = 2
Text = " "
Top = 960
Width = 3495
End
Begin TextBox tapenumber
Height = 375
Left = 2160
TabIndex = 1
Text = " "
Top = 480
Width = 1215
End
Begin CommandButton ButtonFind
Caption = "&Get"
Height = 495
Left = 6120
TabIndex = 3
Top = 240
Width = 975
End
Begin Label Label4
Caption = "In/Out:"
Height = 375
Left = 3720
TabIndex = 17
Top = 1800
Width = 735
End
Begin Label inout_code
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 375
Left = 4560
TabIndex = 18
Top = 1680
Width = 735
End
Begin Label custnum
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 375
Left = 2160
TabIndex = 16
Top = 1680
Width = 1215
End
Begin Label Label3
Caption = "Custmomer checkout:"
Height = 495
Left = 600
TabIndex = 15
Top = 1680
Width = 1215
End
Begin Label Label2
Caption = "Title"
Height = 255
Left = 600
TabIndex = 0
Top = 1080
Width = 1335
End
Begin Label Label1
Caption = "Tape number:"
Height = 255
Left = 600
TabIndex = 4
Top = 600
Width = 1455
End
End
Dim iMode As Integer
Dim blankitemrec As ITEM
Dim saveitemrec As ITEM
Const EDIT_MODE = 0
Const ADD_MODE = 1
Const VIEW_MODE = 2
Sub ButtonCancel_Click ()
If iMode = ADD_MODE Then
itemrec = saveitemrec
rc = GetItemRec(DBKEYED)
If rc Then
rc = GetItemRec(DBFIRST)
End If
End If
FieldsToForm
SetEditMode VIEW_MODE
End Sub
Sub ButtonDelete_Click ()
'
' check if user pressed OK or CANCEL
'
Msg$ = "OK to delete?"
rc = MsgBox(Msg$, MB_OKCANCEL + MB_ICONQUESTION, "DELETE")
If rc = IDCANCEL Then
SetEditMode VIEW_MODE
Exit Sub
End If
rc = DeleteItemRec()
If rc Then
MsgBox "Delete failed, code: " + Str$(rc)
Beep
End If
rc = GetItemRec(DBNEXT)
If rc Then
rc = GetItemRec(DBLAST)
End If
FieldsToForm
SetEditMode VIEW_MODE
End Sub
Sub ButtonDone_Click ()
Unload itemedit
End Sub
Sub ButtonEdit_Click ()
screen.MousePointer = POINTER_HOURGLASS
rc = GetItemRecForUpdate()
If rc Then
screen.MousePointer = POINTER_DEFAULT
Exit Sub
End If
'
' Move the fields to the form again
' In a network environment, someone could have
' changed the record since last time is was shown
'
FieldsToForm
SetEditMode EDIT_MODE
screen.MousePointer = POINTER_DEFAULT
End Sub
Sub ButtonFind_Click ()
FormToFields
rc = GetItemRec(DBKEYED)
If rc Then
Exit Sub
End If
FieldsToForm
End Sub
Sub ButtonFirst_Click ()
rc = GetItemRec(DBFIRST)
If rc = DB_OK Then
FieldsToForm
End If
End Sub
Sub ButtonLast_Click ()
rc = GetItemRec(DBLAST)
If rc = DB_OK Then
FieldsToForm
End If
End Sub
Sub ButtonNew_Click ()
Dim numvalue As Long
SetEditMode ADD_MODE
saveitemrec = itemrec
rc = GetItemRec(DBLAST)
If rc Then
numvalue = 1
Else
numvalue = Val(itemrec.itemnumber)
End If
numvalue = numvalue + 1
itemrec = blankitemrec
itemrec.itemnumber = LTrim$(Str$(numvalue))
FieldsToForm
End Sub
Sub ButtonNext_Click ()
rc = GetItemRec(DBNEXT)
If rc = DB_OK Then
FieldsToForm
End If
End Sub
Sub ButtonOK_Click ()
FormToFields
If iMode = ADD_MODE Then
rc = AddItemRec()
End If
If iMode = EDIT_MODE Then
rc = UpdateItemRec()
End If
'
' Assume if one of these failed, a message was
' already displayed as part of the function.
'
' What to do if the add or update failed?
' For now invoke the CANCEL routine as though
' the user clicked the cancel button.
'
If rc Then
ButtonCancel_Click
Exit Sub
End If
'
' Return to vie